﻿
namespace KTWpm.Clinic.Domain.ValueObjects;

public record Text
{
    public string Value { get; init; }
    public Text(string value)
    {
        Validate(value);
        Value = value;
    }

    private void Validate(string value)
    {
        if (string.IsNullOrWhiteSpace(value))
        {
            throw new ArgumentException("Text cannot be null or empty.", nameof(value));
        }
        if (value.Length > 1000)
        {
            throw new ArgumentException("Text cannot exceed 1000 characters.", nameof(value));
        }
    }

    public static implicit operator Text(string value)
    {
        return new Text(value);
    }

}
